<?php

use think\migration\Migrator;
use think\migration\db\Column;

class PickingStore extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $this->table('picking_store', ['comment' => '分拣单-门店'])
             ->addColumn('store_id', 'integer', ['limit' => 11, "after" => 'id', 'comment' => '门店id'])
             ->addColumn('name', 'string', ['limit' => 500, "after" => 'store_id', 'comment' => '文件名'])
             ->addColumn('is_dow', 'integer', ['limit' => 1, 'default' => 2, 'after' => 'name', 'comment' => '是否下载:1:是,2:否'])
             ->addColumn('is_print', 'integer', ['limit' => 1, 'default' => 2, 'after' => 'is_dow', 'comment' => '是否打印:1:是,2:否'])
             ->addColumn('dow_time', 'integer', ['limit' => 10, 'after' => 'is_print', 'default' => 0, 'comment' => '最后下载时间'])
             ->addColumn('print_time', 'integer', ['limit' => 10, 'after' => 'dow_time', 'default' => 0, 'comment' => '最后打印时间'])
             ->addColumn('pick_time', 'integer', ['limit' => 10, 'after' => 'print_time', 'default' => 0, 'comment' => '用户提货时间'])
             ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'after' => 'pick_time', 'comment' => '1:正常,2:禁用'])
             ->addColumn('create_time', 'integer', ['limit' => 10, 'after' => 'status', 'default' => 0, 'comment' => '创建时间'])
             ->addColumn('update_time', 'integer', ['limit' => 10, 'after' => 'create_time', 'default' => 0, 'comment' => '更新时间'])
             ->addColumn('delete_time', 'integer', ['limit' => 10, 'after' => 'update_time', 'default' => 0, 'comment' => '删除时间'])
             ->create();
    }
}
